home *** CD-ROM | disk | FTP | other *** search
- Path: news.sprintlink.net!datalytics!usenet
- From: Rob Stewart <stew@datalytics.com>
- Newsgroups: comp.lang.c++
- Subject: Re: what is the difference between object orientated programming and lets say C??
- Date: Fri, 22 Mar 1996 13:39:20 -0500
- Organization: Datalytics, Inc
- Message-ID: <3152F3D8.1A67@datalytics.com>
- References: <4iqbiq$1hb@atlas.uniserve.com> <3151730F.606B@staff.ichange.com>
- NNTP-Posting-Host: 204.62.224.71
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Jesse Liberty wrote:
- >
- > Michael Hutchison wrote:
- > >...what exactly object orientated programming is.
- >
- > Well, this can be a matter of some debate, but I think most of us would agree that OO programming is characterized by:
- >
- > 1. A focus on objects -- programming constructs which include data and methods. That is, rather than thinking about data
- > and what functions can be applied against that data, you think about objects and how they maintain change and report on their
- > state.
- >
- > 2. Object oriented programming supports encapsulation and polymorphism. Encapsulation is the concept of an object being
- fully
- > self-contained. The user of an object should understand what that object can do, but should not care about how that object
- > does it. Polymorphism is the idea that you can ask an object to perform a general action and that action will be
- > appropriately carried out based on the specific needs of that specific object. For example, you can ask a window to draw
- > itself, and frame windows, dialog windows, text fields, buttons and so forth will each do the right thing based on their
- own
- > specific (sub-type based) needs.
- >
- > You may want to get a good primer on C++ which introduces each of these concepts and then shows how they are implemented in
- > C++.
- >
-
- The significant difference, then, is that non-OO languages leave
- to you the encapsulation of data and functions. That is, you,
- the programmer, are responsible to always keep straight what
- each function does to the data it is given (explicitly through
- parameters and implicity through statics) and how those changes
- affect other functions. It also helps you control which
- functions may use select data (the access granted to a C++ class
- data member may be public, protected, or private).
-
- OO languages correlate data and the functions that operate on
- them. The correlation--usually by a pair of files--helps track
- and localize changes. It makes the job of tracking side effects
- easier.
-
- The other features, like polymorphism, etc. can be implemented
- (just as the C++ compiler does) through function pointers, etc.
- They may not be trivial, but they don't require the same
- developer diligence. The compiler can readily enforce the rules
- a class creates about which functions may access which data;
- developers are prone to mistakes in tracking this.
-
- --
- Robert Stewart | My opinions are usually my own.
- Datalytics, Inc. | stew@datalytics.com
-